﻿@model IList<jianvgroup.com.Models.CompanyNewsModels.NewsModel>

@section Heads {
    <link rel="stylesheet" type="text/css" href="~/lib/css/plugins/select2/select2.css" />
    <link rel="stylesheet" type="text/css" href="~/lib/css/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.css" />
}

<div class="page-content-wrapper">
    <div class="page-content">
        <!-- BEGIN PAGE HEADER-->
        <div class="page-bar">
            <ul class="page-breadcrumb">
                <li>
                    <i class="fa fa-home"></i>
                    <a href="/home">首页</a>
                    <i class="fa fa-angle-right"></i>
                </li>
                <li>
                    <a href="/CompanyNews">新闻公告</a>
                    <i class="fa fa-angle-right"></i>
                </li>
                <li>
                    <a href="#">列表</a>
                </li>
            </ul>
        </div>
        <h3 class="page-title">
            新闻公告 <small>列表</small>
        </h3>

        <!-- END PAGE HEADER-->
        <!-- BEGIN PAGE CONTENT-->
        <div class="row">
            <div class="col-md-12">
                <!-- BEGIN EXAMPLE TABLE PORTLET-->
                <div class="portlet box grey-cascade">
                    <div class="portlet-title">
                        <div class="caption">
                            <i class="fa fa-globe"></i>新闻公告列表
                        </div>
                    </div>
                    <div class="portlet-body">
                        <table class="table table-striped table-bordered table-hover" id="newsList">
                            <thead>
                                <tr>
                                    <th class="table-checkbox">
                                        <input type="checkbox" class="group-checkable" data-set="#bannerList .checkboxes" />
                                    </th>
                                    <th>
                                        标题
                                    </th>
                                    <th>
                                        内容
                                    </th>
                                    <th>
                                        备注
                                    </th>
                                    <th>
                                        状态
                                    </th>
                                    <th>
                                        操作
                                    </th>
                                </tr>
                            </thead>
                            <tbody>
                                @if (Model != null && Model.Any())
                                {
                                    foreach (var item in Model)
                                    {
                                        <tr class="odd gradeX">
                                            <td>
                                                <input type="checkbox" class="checkboxes" value="1" />
                                            </td>
                                            <td width="10%">
                                                <span title="@item.TitleName">
                                                    @if (!string.IsNullOrWhiteSpace(item.TitleName))
                                                    {
                                                        @string.Format("{0}{1}", item.TitleName.Substring(0, 10), "....")
                                                    }
                                                </span>
                                            </td>
                                            <td width="50%">
                                                <span title="@item.Content">
                                                    @if (!string.IsNullOrWhiteSpace(item.Content))
                                                    {
                                                        @string.Format("{0}{1}", item.Content.Substring(0, 100), "....")
                                                    }
                                                </span> 
                                            </td>
                                            <td width="20%">
                                                <span title="@item.Remark">
                                                    @if (!string.IsNullOrWhiteSpace(item.Remark))
                                                    {
                                                        @string.Format("{0}{1}", item.Remark.Substring(0, 30), "....")
                                                    }
                                                </span>
                                            </td>
                                            <td>
                                                @{
                                                    var getNewStatus = (item.Status == 0) ? "上线" : "下线";
                                                }

                                                @getNewStatus
                                            </td>
                                            <td>
                                                <a href="/CompanyNews/Create/@item.SysId" class="btn default btn-xs purple">
                                                    <i class="fa fa-edit"></i> 编辑
                                                </a>
                                                <a onclick="return confirm('您确定要删除吗？')" href="/CompanyNews/Delete/@item.SysId" c class="btn default btn-xs black remove">
                                                    <i class="fa fa-trash-o"></i> 删除
                                                </a>
                                            </td>
                                        </tr>
                                                        }
                                                    }
                            </tbody>
                        </table>
                        @*@Html.Partial("_BasePager", ViewData["pageModel"])*@
                    </div>
                </div>
                <!-- END EXAMPLE TABLE PORTLET-->
            </div>
        </div>
        <!-- END PAGE CONTENT-->
    </div>
</div>
@section Scripts {
    <script type="text/javascript" src="~/lib/css/plugins/datatables/media/js/jquery.dataTables.min.js"></script>
    <script type="text/javascript" src="~/lib/css/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.js"></script>
   <script type="text/javascript" src="~/scripts/news.js"></script>
    <script>
        jQuery(document).ready(function () {
            Metronic.init(); // init metronic core componets
            Layout.init(); // init layout
            newsList.init();
            $(".page-sidebar-menu li:nth-child(3) .title").after("<span class='selected'></span>");
            $(".page-sidebar-menu li:nth-child(3) .arrow").addClass("open");
            $(".page-sidebar-menu li:nth-child(3)").addClass("active open");
            $(".page-sidebar-menu li:nth-child(3) .sub-menu li:nth-child(1)").addClass("active");
        });
    </script>
}